home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
051-075
/
069
/
icontype
/
icontype.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-13
|
2KB
|
74 lines
/* IconType - a program to change the type of icon. Useful for changing
* an icon's type after editing with IconEd.
*
* Icon types are Disk, Drawer, Tool, Project, Garbage, and Device
*
* Syntax: icontype <filename> <type>
*
* Example: icontype test.info project
* (changes the icon "test.info" to a project icon)
*
* by: Larry Phillips, CIS 76703,4322
*/
#include "exec/types.h"
#include "exec/nodes.h"
#include "exec/lists.h"
#include "exec/libraries.h"
#include "exec/ports.h"
#include "exec/interrupts.h"
#include "exec/io.h"
#include "exec/memory.h"
#include "libraries/dos.h"
#include "libraries/dosextens.h"
extern struct FileHandle *Open();
main (argc,argv)
int argc;
char *argv[];
{
struct FileHandle *file;
unsigned char buf;
static char *type[7] = { "","disk","drawer","tool","project","garbage","device" };
if ((argc < 3)||(argc > 3))
{
puts("Usage: IconType <filename> <type>\nTypes are disk, drawer, tool, project, garbage, device.");
}
else
{
if ((file = Open(argv[1],MODE_OLDFILE))==0)
{
puts ("Unable to open icon file.");
Exit();
}
Read (file,&buf,1L);
if (buf == 0xE3)
{
Read (file,&buf,1L);
if (buf == 0x10)
{
Seek (file, 48L,(long) OFFSET_BEGINNING);
tolower (argv[2]);
for (buf = 1;buf < 7;buf++)
if (strcmp(argv[2],type[buf])==0)
{
Write (file,&buf,1L);
break;
}
if (buf == 7) puts ("Invalid icon type.");
printf("%d ",buf);
}
else puts ("Not an icon file.");
}
else puts ("Not an icon file.");
Close (file);
Exit ();
}
}